package pl.poznan.put.cs.idss.viamdp.core.structures;

/**
 * Pole terminalne, po wejściu na nie następje zakończenie z dodatnią nagrodą.
 * 
 * @author Kornel Lewandowski
 * 
 */
public class TerminalField extends AbstractField implements IField {

	public TerminalField(int positionX, int positionY, Map worldMap) {
		super(positionX, positionY, worldMap);
	}

	public double calculateCurrentReward() {
		setRewardValue(worldMap.getTerminalFieldValue());
		return worldMap.getTerminalFieldValue();
	}

	public void setRewardValue(double reward) {
		history.add(new Double(reward));
	}

	public double getReward(long iteration) {
		if (history.size() > (int) iteration) {
			return history.get((int) iteration);
		} else {
			return worldMap.getTerminalFieldValue();
		}
	}

	public double getLastReward() {
		return history.get(history.size() - 1);
	}

	public boolean checkIfRewardChange() {
		return false;
	}

	@Override
	public String toString() {
		return "[ + ]";
	}

}
